/**
 * 
 */
package com.demo2do.fms.scheduler.entity;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Ysy
 *
 */
public class Branch {

    /** id */
    private String id;
    
    /** 代码  */
    private String code;
    
    /** 名称  */
    private String name;
    
    /** 版本  */
    private Long version;
    
    /** 状态： -1, 1  */
    private Long state;
    
    /**
     * the default constructor
     */
    public Branch() {
    }
    
    /**
     * 
     * @return
     */
    public Branch stateToDisabled() {
        
        // if state is 1, means that is_disabled is 0
        this.state = (long) (this.state.longValue() == 1 ? 0 : 1);
        
        return this;
        
    }
    
    /**
     * 
     * @return
     */
    public Map<String, Object> describe() {
        Map<String, Object> result = new HashMap<String, Object>();
        
        result.put("id", this.id);
        result.put("name", this.name);
        result.put("code", this.code);
        result.put("version", this.version);
        result.put("state", this.state);
        
        return result;
    }
    
    /**
     * @return the id
     */
    public String getId() {
        return id;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @return the code
     */
    public String getCode() {
        return code;
    }

    /**
     * @return the version
     */
    public Long getVersion() {
        return version;
    }

    /**
     * @return the state
     */
    public Long getState() {
        return state;
    }

    /**
     * @param id the id to set
     */
    public void setId(String id) {
        this.id = id;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @param code the code to set
     */
    public void setCode(String code) {
        this.code = code;
    }

    /**
     * @param version the version to set
     */
    public void setVersion(Long version) {
        this.version = version;
    }

    /**
     * @param state the state to set
     */
    public void setState(Long state) {
        this.state = state;
    }
}
